var globalData = {
	server: "http://localhost:8080/",
	pre: "http://127.0.0.1:8080/",
	socket: "ws://localhost:8080/",
	//把登陆的用户名存入h5的缓存
	setUserInfo: function(username, uid,utype) {
		window.sessionStorage.setItem("username", username);
		window.sessionStorage.setItem("uid", uid);
		window.sessionStorage.setItem("utype", utype);
	},
	setUserName: function(username) {
		window.sessionStorage.setItem("username", username);
	},
	//从H5缓存中取出当前登录的用户名
	getUserName: function() {
		return window.sessionStorage.getItem("username");
	},
	getUType: function() {
		return window.sessionStorage.getItem("utype");
	},
	getUid: function() {
		return window.sessionStorage.getItem("uid");
	},
	//退出登录
	loginOut: function() {
		globalData.setUserInfo(null, null,null);
		window.location.href = "login.html";
	}
};
var a = globalData.getUserName();
if(a == null || a == "null") {
	var url = window.location.href;
	if(url.indexOf("login.html") >= 0) {

	} else {
		window.location.href = "login.html";
	}
} else {
	var url = window.location.href;
	if(url.indexOf("login.html") >= 0) {
		window.location.href = "index.html";
	}
}
